/*
 * @lc app=leetcode.cn id=11 lang=cpp
 *
 * [11] 盛最多水的容器
 */

// @lc code=start
class Solution {
public:
    int maxArea(vector<int>& height) {
        int l = 0, r = height.size() - 1;
        unsigned int max = 0;
        while (l < r) {
            int volume = 0;
            if (height[l] > height[r]) {
                volume = height[r] * (r - l);
                r--;
            }

            else {
                volume = height[l]* (r - l);
                l++;
            }
            
            max = max > volume ? max : volume;
        }

        return max;
    }
};
// @lc code=end

